package cn.iocoder.yudao.module.iot.dal.mysql.devicedataupload;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.iot.dal.dataobject.devicedataupload.DeviceDataUploadDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.iot.controller.admin.devicedataupload.vo.*;

/**
 * 物联网设备上报数据记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface DeviceDataUploadMapper extends BaseMapperX<DeviceDataUploadDO> {

    default PageResult<DeviceDataUploadDO> selectPage(DeviceDataUploadPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceDataUploadDO>()
                .likeIfPresent(DeviceDataUploadDO::getDeviceName, reqVO.getDeviceName())
                .eqIfPresent(DeviceDataUploadDO::getMsgId, reqVO.getMsgId())
                .eqIfPresent(DeviceDataUploadDO::getMethod, reqVO.getMethod())
                .eqIfPresent(DeviceDataUploadDO::getAck, reqVO.getAck())
                .eqIfPresent(DeviceDataUploadDO::getInusing, reqVO.getInusing())
                .eqIfPresent(DeviceDataUploadDO::getWdbjysz, reqVO.getWdbjysz())
                .eqIfPresent(DeviceDataUploadDO::getBjfz, reqVO.getBjfz())
                .eqIfPresent(DeviceDataUploadDO::getWd, reqVO.getWd())
                .eqIfPresent(DeviceDataUploadDO::getRd, reqVO.getRd())
                .eqIfPresent(DeviceDataUploadDO::getPqzt, reqVO.getPqzt())
                .eqIfPresent(DeviceDataUploadDO::getQfzt, reqVO.getQfzt())
                .eqIfPresent(DeviceDataUploadDO::getBjzt, reqVO.getBjzt())
                .eqIfPresent(DeviceDataUploadDO::getBclpEr, reqVO.getBclpEr())
                .eqIfPresent(DeviceDataUploadDO::getSdno, reqVO.getSdno())
                .eqIfPresent(DeviceDataUploadDO::getWranType, reqVO.getWranType())
                .eqIfPresent(DeviceDataUploadDO::getBdzt, reqVO.getBdzt())
                .eqIfPresent(DeviceDataUploadDO::getBiaoding, reqVO.getBiaoding())
                .eqIfPresent(DeviceDataUploadDO::getErrMsg, reqVO.getErrMsg())
                .betweenIfPresent(DeviceDataUploadDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceDataUploadDO::getId));
    }

    default List<DeviceDataUploadDO> selectList(DeviceDataUploadExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DeviceDataUploadDO>()
                .likeIfPresent(DeviceDataUploadDO::getDeviceName, reqVO.getDeviceName())
                .eqIfPresent(DeviceDataUploadDO::getMsgId, reqVO.getMsgId())
                .eqIfPresent(DeviceDataUploadDO::getMethod, reqVO.getMethod())
                .eqIfPresent(DeviceDataUploadDO::getAck, reqVO.getAck())
                .eqIfPresent(DeviceDataUploadDO::getInusing, reqVO.getInusing())
                .eqIfPresent(DeviceDataUploadDO::getWdbjysz, reqVO.getWdbjysz())
                .eqIfPresent(DeviceDataUploadDO::getBjfz, reqVO.getBjfz())
                .eqIfPresent(DeviceDataUploadDO::getWd, reqVO.getWd())
                .eqIfPresent(DeviceDataUploadDO::getRd, reqVO.getRd())
                .eqIfPresent(DeviceDataUploadDO::getPqzt, reqVO.getPqzt())
                .eqIfPresent(DeviceDataUploadDO::getQfzt, reqVO.getQfzt())
                .eqIfPresent(DeviceDataUploadDO::getBjzt, reqVO.getBjzt())
                .eqIfPresent(DeviceDataUploadDO::getBclpEr, reqVO.getBclpEr())
                .eqIfPresent(DeviceDataUploadDO::getSdno, reqVO.getSdno())
                .eqIfPresent(DeviceDataUploadDO::getWranType, reqVO.getWranType())
                .eqIfPresent(DeviceDataUploadDO::getBdzt, reqVO.getBdzt())
                .eqIfPresent(DeviceDataUploadDO::getBiaoding, reqVO.getBiaoding())
                .eqIfPresent(DeviceDataUploadDO::getErrMsg, reqVO.getErrMsg())
                .betweenIfPresent(DeviceDataUploadDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceDataUploadDO::getId));
    }

}
